{extend name="base" /}
{block name="body"}

    <!--tab标签-->
    <div class="layui-tab-brief">

        <div class="layui-tab-content">
            <div class="layui-tab-item layui-show">
                <form class="layui-form form-container" data-url="{:es_url('slideimgEdit')}"  localtion-url="{:es_url('slideimgList')}">
                    <div class="layui-form-item">
                        <label class="layui-form-label">轮播图名称</label>
                        <div class="layui-input-inline">
                            <input type="text" name="title" value="{$info.title}" required  lay-verify="required" placeholder="请输入轮播图名称" class="layui-input">
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <label class="layui-form-label">轮播图链接</label>
                        <div class="layui-input-block">
                    
                        <input type="text" name="url" value="{$info.url}" required  lay-verify="required" placeholder="请输入轮播图链接" class="layui-input">
                        </div>
                    </div>
                    
                          <div class="layui-form-item">
                        <label class="layui-form-label">类型</label>
                        <div class="layui-input-inline">
                              <select name="type" class="layui-input">
                                            
                                                    <option value="1"  {if condition="$info['type'] eq 1"}selected{/if}>WAP</option>
                                                    <option value="2"  {if condition="$info['type'] eq 2"}selected{/if}>网站</option>
                                                    <option value="3"  {if condition="$info['type'] eq 3"}selected{/if}>小程序</option>
                                                    <option value="4"  {if condition="$info['type'] eq 4"}selected{/if}>APP</option>
                                           
                             </select>
                        </div>
                    </div>
                    
 <div class="layui-form-item">
                        <label class="layui-form-label">图片</label>
                        <div class="layui-input-block">
                         
                          <div id='upload_show_div1' style="width:120px;display: inline;">
                    <img style='max-width:100px; margin-right: 20px;' src="{$info['cover_id']|default='0'|get_picture_url}" />
                </div>
               
                <input type="hidden" name="cover_id" id='cover_id' value="{$info['cover_id']|default='0'}"/>
                         <div id="coverimg1"></div>   
                   <span class="layui-btn layui-btn-primary layui-btn-small clearid" data-name="cover_id" data-divname="upload_show_div1" >清除图片</span>
                        
                       
                        </div>
                    </div>
                    
                    
             
                    
                    <link rel="stylesheet" href="__PUBLIC__/js/webuploader/webuploader.css" />
<script src="__PUBLIC__/js/webuploader/webuploader.nolog.min.js"></script>
<script>
$(function(){
	$('.clearid').click(function(){
		
		var id=$(this).data('name');
		var div=$(this).data('divname');
		$('#'+id).val(0);
		$('#'+div).find('img').attr('src','__PUBLIC__/images/onimg.png');
		
		
	});
	
});
var upload_param1 = WebUploader.create({

    // 选完文件后，是否自动上传。
    auto: true,

    // swf文件路径
    swf: "WEB_URL"+'/addon/imginput/static/dist/Uploader.swf',
    chunked: false,
    chunkSize: 512 * 1024,
    // 文件接收服务端。
    server: "{:es_url('File/pictureUpload')}",

    // 选择文件的按钮。可选。
    // 内部根据当前运行是创建，可能是input元素，也可能是flash.
    pick: {
            id: '#coverimg1',
            label: '点击选择文件'
        },
        fileNumLimit: 1,
        disableGlobalDnd: true,
    // 只允许选择图片文件。
    accept: {
       
    }
});

upload_param1.on('uploadSuccess',function( file, response) {

	 var show_img_url = response.headpath;

	  
	    $( '#upload_show_div1').html("<img style='max-width:100px; margin-right: 20px;' src='"+show_img_url+"' />");
	    $('#cover_id').val(response.id);

});


</script>
                            
                  
                            <input type="hidden"  name="id"  value="{$info.id}">
                         <div class="btable-paged" >
				<div class="layui-main">
                    <div class="formbtngroup">
<button class="layui-btn layui-btn-small" lay-submit="" lay-filter="formadd">更新</button>
<a href="javascript:;"  class="layui-btn layui-btn-primary layui-btn-small closebtn">返回</a>
</div>
</div>
        </div>
                </form>
            </div>
        </div>
    </div>
{/block}
